package leetcode.code1403;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import leetcode.IDebug;

public class Solution implements IDebug {

	public List<Integer> minSubsequence(int[] nums) {
		Arrays.sort(nums);
		int sum = 0;
		for (int num : nums) {
			sum += num;
		}
		List<Integer> ans = new ArrayList<>();
		int sum1 = 0;
		for (int i = nums.length - 1; i > -1 && sum1 <= sum; i--) {
			int num = nums[i];
			sum1 += num;
			sum -= num;
			ans.add(num);
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
